﻿using System;
using System.Linq;

namespace ProyectoDeTesis.Modelos.Util
{
    public class GeneradorLogin
    {
        public string NUMEROS = "0123456789";
        public string MAYUSCULAS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        public string MINUSCULAS = "abcdefghijklmnopqrstuvwxyz";
        public string ESPECIALES = "ñÑ";
        private Random randNum = new Random();

        public string getPinNumber()
        {
            return getPassword(NUMEROS, 4);
        }

        public string getPassword()
        {
            return getPassword(8);
        }

        public string getPassword(int length)
        {
            return getPassword(NUMEROS + MAYUSCULAS + MINUSCULAS, length);
        }

        public string getPassword(String key, int length)
        {
            string pswd = "";

            for (int i = 0; i < length; i++)
            {
                pswd += (key.ElementAt(randNum.Next(0, key.Count() - 1)));
            }

            return pswd;
        }
    }

}
